# Maintainer: Øystein Krog <oystein.krog@gmail.com>

_realname=hub
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.2.1
pkgrel=1
pkgdesc="hub introduces git to GitHub (mingw-w64)"
arch=('any')
url="https://hub.github.com"
license=('MIT')
options=('!strip')
#TODO: change this when git-for-windows is upstreamed
#depends=('${MINGW_PACKAGE_PREFIX}-git')
depends=('git')
makedepends=("git" "${MINGW_PACKAGE_PREFIX}-go")
source=(${_realname}-${pkgver}.tar.gz::https://github.com/github/${_realname}/archive/v${pkgver}.tar.gz)
sha256sums=('9350aba6a8e3da9d26b7258a4020bf84491af69595f7484f922d75fc8b86dc10')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  GOROOT=${MINGW_PREFIX}/lib/go ./script/build
  gzip --best -c man/${_realname}.1> ${_realname}.1.gz
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"

  install -Dm755 "${_realname}" "${pkgdir}${MINGW_PREFIX}/bin/${_realname}"

  install -Dm644 "LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
  install -Dm644 "man/${_realname}.1" "${pkgdir}${MINGWPREFIX}/share/man/man1/${_realname}.1"

  install -Dm644 "etc/hub.bash_completion.sh" "${pkgdir}/usr/share/bash-completion/completions/hub"
  install -Dm644 "etc/hub.zsh_completion" "${pkgdir}/usr/share/zsh/site-functions/_hub"
}
